<?php
if(!class_exists('EventManager_Resource_Adres_Item')){
	require_once dirname(__FILE__) . '/Adres/Item.php';
}
if (!class_exists('EventManager_Resource_Adres_Interface')) {
	require_once dirname(__FILE__) . '/Adres/Interface.php';
}

if (!class_exists('EventManager_Resource_Event')) {
	require_once dirname(__FILE__) . '/Event.php';
}



class EventManager_Resource_Adres extends SF_Model_Resource_Db_Table_Abstract implements EventManager_Resource_Adres_Interface{
	/**
	 * @var string $_name
	 */
	protected $_name = 	'addresses';
	/**
	 * @var string $_primary
	 */
	protected $_primary = 'adr_id';
	/**
	 * @var string $_rowClass
	 */
	protected $_rowClass = 'EventManager_Resource_Adres_Item';
	/**
	 * @var array $_referenceMap
	 */
	protected $_referenceMap = array(
		'adr' =>array(
		'columns' 		=>	array('adr_id'),
		'refTableClass'	=>	'EventManager_Resource_Event',
		'refColumns'	=>	'adr_id',
	));

	/**
	 * function getAdresById
	 * @see modules/eventManager/models/resources/Adres/EventManager_Resource_Adres_Interface#getAdresById($id)
	 *
	 */
	public function getAdresById($id){
		$select =	$this->select()
		->where('adr_id = ?', $id);
		return $this->fetchRow($select);
	}
}